package edu.uclmgmu.bacteriosec.aspects.java.io.BOS;

import java.io.*;

import edu.uclmgmu.bacteriosec.aspects.common.Store;

privileged aspect BufferedOutputStream_CountCalls {
	
	void around(java.io.BufferedOutputStream caller) : call(void java.io.BufferedOutputStream.flush()) && 
			target(caller) && 
			!cflow(within(BufferedOutputStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
			&& !within(junit.*) {
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
		proceed(caller);
	}
	
	void around(java.io.BufferedOutputStream caller, byte[] a, int b, int c) : 
				call(void java.io.BufferedOutputStream.write(byte[], int, int)) && 
			target(caller) && args(a, b, c) &&
			!cflow(within(BufferedOutputStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
			&& !within(junit.*) {
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
		proceed(caller, a, b, c);
	}

	void around(java.io.BufferedOutputStream caller) : 
		call(void java.io.BufferedOutputStream.close()) && 
			target(caller) &&
			!cflow(within(BufferedOutputStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
			&& !within(junit.*) {
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
		proceed(caller);
	}
}
